#ifndef MEETCONTROLPAGE_H
#define MEETCONTROLPAGE_H

#include <QWidget>
#include <QTimer>
#include <QHash>
#include <QThread>
#include "../remoteservice/baseresp.h"

namespace Ui {
class MeetControlPage;
}

class CallControlPanel;
class QLabel;
class MeetPageWorker;

class MeetControlPage : public QWidget
{
    Q_OBJECT
    
public:
    explicit MeetControlPage(QWidget *parent = 0);
    ~MeetControlPage();

    void reset();


signals:
    void updatePanel();

public slots:
    void refreshPanel(bool,bool,bool,bool);

protected:
    bool eventFilter(QObject *, QEvent *);
    void initFocusOrder();
    void paintEvent(QPaintEvent *e);
    void showEvent(QShowEvent *);
    void hideEvent(QHideEvent *);
    void keyReleaseEvent(QKeyEvent *);
    bool event(QEvent *e);

private slots:
    void timerHandle();
    void aquireFocus();
    void exit();
    void showConnectInfo(bool s);
    void exitSlot(BaseResp);
    void updateCellName(QString);

private:
    void clearLabels();
    void showPage(int page);
    
private:
    Ui::MeetControlPage *ui;
    QTimer m_timer;
    QHash<QObject*, QList<QObject*> > m_ctrlOrder;
    CallControlPanel *m_ctrlpanel;

    QLabel* m_directs[10];
    QLabel* m_protocols[10];
    QLabel* m_callrates[10];
    QLabel* m_resolutins[10];
    QLabel* m_fpss[10];
    QLabel* m_loses[10];
    QLabel* m_safes[10];
    QLabel* m_icons[10];
    QLabel* m_cellNames[16];

    int curPage, maxPage;
    QList<QList<QString> > m_statList;

    MeetPageWorker *worker;
    QThread workThread;
};

#endif // MEETCONTROLPAGE_H
